home *** CD-ROM | disk | FTP | other *** search
- /*
- * Test application for CForms.
- * @(#) validate.frm,v 1.3 1993/07/21 01:26:14 lasse Exp
- */
-
- Viewport view {
- Pos 0,0;
- Size 80, 23;
- }
-
- Event Key DOWN { fld_move(fld_down(NULL)); }
- Event Key UP { fld_move(fld_up(NULL)); }
- Event Key ESC { pic_leave(); }
-
- Picture Validate Viewport View
- {
- Literal Center, 1, "Test of a validation EXIT event";
- Literal +0, 2, "--------------------------------";
- Literal Center, Max, "(Press ESC to exit)";
-
- Field Date {
- Pos 35, 8;
- Type Char(8);
- LValue "Enter year of birth (yy-mm-dd): ";
- Event Exit {
- int a, b, c;
- char buf[50];
- if (sscanf(fld_get(NULL), "%2d-%2d-%2d", &a, &b, &c) != 3) {
- message("Illegal format");
- fld_move(NULL);
- }
- else
- {
- sprintf(buf, "%02d-%02d-%02d", a, b, c);
- fld_set(NULL, buf);
- }
- }
- }
-
- Field Sex {
- Pos +0, +1;
- Type Char(8);
- LValue "Male/Female: ";
- Uppercase;
- Event Exit {
- if (strequ(fld_get_trimmed(NULL), "male") != 0 &&
- strequ(fld_get_trimmed(NULL), "female") != 0)
- {
- message("Must be male or female (%s)", fld_get_trimmed(NULL));
- fld_set(NULL, "");
- fld_move(NULL);
- }
- }
- }
- }
-